package com.fintech.common.util;

import com.fintech.common.enums.RespStatus;

import java.io.Serializable;
import java.util.Date;

/**
 * 类说明：接口统一返回实体
 * 
 * @date 2017年3月11日
 * @author SHAOYUN
 *
 **/

public class ApiResponse<E> implements Serializable {

	private static final long serialVersionUID = 1L;

	private String msg;
	private int code;
	private Date responseTime;
	private E data;

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public Date getResponseTime() {
		return responseTime;
	}

	public void setResponseTime(Date responseTime) {
		this.responseTime = responseTime;
	}

	public E getData() {
		return data;
	}

	public void setData(E data) {
		this.data = data;
	}

	public void setCodeAndMessage(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public void setCodeAndMessage(RespStatus respStatus) {
		this.code = respStatus.getCode();
		this.msg = respStatus.getMsg();
	}

	@Override
	public String toString() {
		return "ApiResponse [msg=" + msg + ", code=" + code + ", responseTime=" + responseTime + ", data=" + data + "]";
	}

}
